import json
import jsonlines

s = []
p = []
t = []

old_path = './prompt.json'
new_path = './test.json'
instance = []

# 读取
for pop_dict in jsonlines.Reader(open(old_path, 'r')):
    source = pop_dict['source']
    target = pop_dict['target']
    prompt = pop_dict['prompt']
    temp = {"source": source, "target": target, "prompt": "best quality,masterpiece"}
    instance.append(temp)


# 写入
with open(new_path, 'w') as f:
    for i in instance:
        json.dump(i, f)
        f.write("\n")


pass
